import { ApiProperty } from '@nestjs/swagger';
import { IsEmail, IsNotEmpty, MaxLength } from 'class-validator';

export class CreateCommentDto {
  @ApiProperty({ description: 'ip地址' })
  ip: string;
  @ApiProperty({ description: '评论者的环境' })
  ua: string;

  @ApiProperty({ description: '内容' })
  @IsNotEmpty()
  @MaxLength(200)
  content: string;

  @ApiProperty({ description: '评论用户头像' })
  avatar: string;

  @ApiProperty({ description: '评论用户邮箱' })
  @IsEmail()
  @IsNotEmpty()
  @MaxLength(100)
  email: string;

  @ApiProperty({ description: '评论人名称' })
  @MaxLength(20)
  @IsNotEmpty()
  name: string;

  @ApiProperty({ description: '评论父级' })
  parent?: number;
  @ApiProperty({ description: '被评论人名称' })
  replyName?: string;
  @ApiProperty({ description: '被评论人邮箱' })
  replyEmail?: string;

  @ApiProperty({ description: '是否置顶' })
  putTop?: boolean = false;
  @ApiProperty({ description: '相关检测结果详细信息' })
  suggestion?: string;

  @ApiProperty({ description: '状态' })
  status?: string;

  @ApiProperty({ description: '资源id' })
  @IsNotEmpty()
  resourceId: string;

  @ApiProperty({ description: '是否是管理员' })
  isAdmin?: boolean = false;
}
